.TH "nrf/rfhelp.c" 3 "Wed Sep 16 2015" "Doxygen" \" -*- nroff -*-
.ad l
.nh
.SH NAME
nrf/rfhelp.c \- 
.SH SYNOPSIS
.br
.PP
\fC#include 'rfhelp\&.h'\fP
.br
\fC#include 'rf\&.h'\fP
.br
\fC#include 'ch\&.h'\fP
.br
\fC#include 'hal\&.h'\fP
.br
\fC#include 'crc\&.h'\fP
.br
\fC#include <string\&.h>\fP
.br
\fC#include <stdbool\&.h>\fP
.br

.SS "Functions"

.in +1c
.ti -1c
.RI "void \fBrfhelp_init\fP (void)"
.br
.ti -1c
.RI "void \fBrfhelp_restart\fP (void)"
.br
.ti -1c
.RI "int \fBrfhelp_send_data\fP (char *data, int len)"
.br
.ti -1c
.RI "int \fBrfhelp_send_data_crc\fP (char *data, int len)"
.br
.ti -1c
.RI "int \fBrfhelp_read_rx_data\fP (char *data, int *len, int *pipe)"
.br
.ti -1c
.RI "int \fBrfhelp_read_rx_data_crc\fP (char *data, int *len, int *pipe)"
.br
.ti -1c
.RI "int \fBrfhelp_rf_status\fP (void)"
.br
.ti -1c
.RI "void \fBrfhelp_set_tx_addr\fP (const char *addr, int addr_len)"
.br
.ti -1c
.RI "void \fBrfhelp_set_rx_addr\fP (int pipe, const char *addr, int addr_len)"
.br
.ti -1c
.RI "void \fBrfhelp_power_down\fP (void)"
.br
.ti -1c
.RI "void \fBrfhelp_power_up\fP (void)"
.br
.in -1c
.SH "Function Documentation"
.PP 
.SS "void rfhelp_init (void)"

.SS "void rfhelp_power_down (void)"

.SS "void rfhelp_power_up (void)"

.SS "int rfhelp_read_rx_data (char * data, int * len, int * pipe)"
Read data from the RX fifo
.PP
\fBParameters:\fP
.RS 4
\fIdata\fP Pointer to the array in which to store the data\&.
.br
\fIlen\fP Pointer to variable storing the data length\&.
.br
\fIpipe\fP Pointer to the pipe on which the data was received\&. Can be 0\&.
.RE
.PP
\fBReturns:\fP
.RS 4
1: Read OK, more data to read\&. 0: Read OK -1: No RX data -2: Wrong length read\&. Something is likely wrong\&. 
.RE
.PP

.SS "int rfhelp_read_rx_data_crc (char * data, int * len, int * pipe)"
Same as rfhelp_read_rx_data, but will check if there is a valid CRC in the end of the payload\&.
.PP
\fBParameters:\fP
.RS 4
\fIdata\fP Pointer to the array in which to store the data\&.
.br
\fIlen\fP Pointer to variable storing the data length\&.
.br
\fIpipe\fP Pointer to the pipe on which the data was received\&. Can be 0\&.
.RE
.PP
\fBReturns:\fP
.RS 4
1: Read OK, more data to read\&. 0: Read OK -1: No RX data -2: Wrong length read\&. Something is likely wrong\&. -3: Data read, but CRC does not match\&. 
.RE
.PP

.SS "void rfhelp_restart (void)"
Re-init the rf chip 
.SS "int rfhelp_rf_status (void)"

.SS "int rfhelp_send_data (char * data, int len)"
Set TX mode, send data, wait for result, set RX mode\&.
.PP
\fBParameters:\fP
.RS 4
\fIdata\fP The data to be sent\&.
.br
\fIlen\fP Length of the data\&.
.RE
.PP
\fBReturns:\fP
.RS 4
0: Send OK\&. -1: Max RT\&. -2: Timeout 
.RE
.PP

.SS "int rfhelp_send_data_crc (char * data, int len)"
Same as rfhelp_send_data, but will add a crc checksum to the end\&. This is useful for protecting against corruption between the NRF and the MCU in case there are errors on the SPI bus\&.
.PP
\fBParameters:\fP
.RS 4
\fIdata\fP The data to be sent\&.
.br
\fIlen\fP Length of the data\&. Should be no more than 30 bytes\&.
.RE
.PP
\fBReturns:\fP
.RS 4
0: Send OK\&. -1: Max RT\&. -2: Timeout 
.RE
.PP

.SS "void rfhelp_set_rx_addr (int pipe, const char * addr, int addr_len)"

.SS "void rfhelp_set_tx_addr (const char * addr, int addr_len)"

.SH "Author"
.PP 
Generated automatically by Doxygen from the source code\&.
